﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

using eSYSU.Model;
using eSYSU.DAL;

namespace eSYSU.Business
{
    /// <summary>
    /// eSYSU微博相关业务
    /// </summary>
    public class WeiboService
    {
        public WeiboService()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        /// <summary>
        /// 微博绑定更新
        /// </summary>
        /// <param name="weibo">微博绑定对象</param>
        /// <returns>绑定结果</returns>
        public static bool WeiboBindingUpdate(WeiboBinding weibo)
        {
            if (weibo != null)
            {
                IDictionary<string, object> parmsDic = new Dictionary<string, object>();
                parmsDic.Add("@_UserId", weibo.userId);
                parmsDic.Add("@_Name", weibo.name);
                parmsDic.Add("@_Type", weibo.type);
                parmsDic.Add("@_WeiboUserId", weibo.weiboUserId);
                parmsDic.Add("@_ScreenName", weibo.screenName);
                parmsDic.Add("@_AccessToken", weibo.accessToken);
                parmsDic.Add("@_AccessSecret", weibo.accessSecret);

                if (eSYSU.DAL.SqlHelper.ExecuteNonQuery(eSYSU.DAL.SqlHelper.ConnString, 
                    CommandType.StoredProcedure, eSYSU.Common.Constants.PROC_WEIBO_UPDATE, parmsDic) != -1)
                    return true;
                else return false;
            }
            return false;
        }
    }
}